﻿Namespace B1Objects
    Friend Class Item
        Implements B1Objects.IItem

        Public Shared Function NewItem(ByVal sapItem As SAPbouiCOM.Item) As B1Objects.IItem
            Return New Item(sapItem)
        End Function

        Private _SapItem As SAPbouiCOM.Item

        Private Sub New(ByVal SapItem As SAPbouiCOM.Item)
            _SapItem = SapItem
        End Sub

        Public Property AffectsFormMode As Boolean Implements SAPbouiCOM.IItem.AffectsFormMode
            Get
                Return _SapItem.AffectsFormMode
            End Get
            Set(ByVal value As Boolean)
                _SapItem.AffectsFormMode = value
            End Set
        End Property

        Public Property BackColor As Integer Implements SAPbouiCOM.IItem.BackColor
            Get
                Return _SapItem.BackColor
            End Get
            Set(ByVal value As Integer)
                _SapItem.BackColor = value
            End Set
        End Property

        Public Sub Click(Optional ByVal ClickType As SAPbouiCOM.BoCellClickType = SAPbouiCOM.BoCellClickType.ct_Regular) Implements SAPbouiCOM.IItem.Click
            _SapItem.Click(ClickType)
        End Sub

        Public Property Description As String Implements SAPbouiCOM.IItem.Description
            Get
                Return _SapItem.Description
            End Get
            Set(ByVal value As String)
                _SapItem.Description = value
            End Set
        End Property

        Public Property DisplayDesc As Boolean Implements SAPbouiCOM.IItem.DisplayDesc
            Get
                Return _SapItem.DisplayDesc
            End Get
            Set(ByVal value As Boolean)
                _SapItem.DisplayDesc = value
            End Set
        End Property

        Public Property Enabled As Boolean Implements SAPbouiCOM.IItem.Enabled
            Get
                Return _SapItem.Enabled
            End Get
            Set(ByVal value As Boolean)
                _SapItem.Enabled = value
            End Set
        End Property

        Public Property FontSize As Integer Implements SAPbouiCOM.IItem.FontSize
            Get
                Return _SapItem.FontSize
            End Get
            Set(ByVal value As Integer)
                _SapItem.FontSize = value
            End Set
        End Property

        Public Property ForeColor As Integer Implements SAPbouiCOM.IItem.ForeColor
            Get
                Return _SapItem.ForeColor
            End Get
            Set(ByVal value As Integer)
                _SapItem.ForeColor = value
            End Set
        End Property

        Public Property FromPane As Integer Implements SAPbouiCOM.IItem.FromPane
            Get
                Return _SapItem.FromPane
            End Get
            Set(ByVal value As Integer)
                _SapItem.FromPane = value
            End Set
        End Property

        Public Function GetAutoManagedAttribute(ByVal AttrType As SAPbouiCOM.BoAutoManagedAttr, ByVal Mode As SAPbouiCOM.BoAutoFormMode) As SAPbouiCOM.BoModeVisualBehavior Implements SAPbouiCOM.IItem.GetAutoManagedAttribute
            Return _SapItem.GetAutoManagedAttribute(AttrType, Mode)
        End Function

        Public Property Height As Integer Implements SAPbouiCOM.IItem.Height
            Get
                Return _SapItem.Height
            End Get
            Set(ByVal value As Integer)
                _SapItem.Height = value
            End Set
        End Property

        Public Property Left As Integer Implements SAPbouiCOM.IItem.Left
            Get
                Return _SapItem.Left
            End Get
            Set(ByVal value As Integer)
                _SapItem.Left = value
            End Set
        End Property

        Public Property LinkTo As String Implements SAPbouiCOM.IItem.LinkTo
            Get
                Return _SapItem.LinkTo
            End Get
            Set(ByVal value As String)
                _SapItem.LinkTo = value
            End Set
        End Property

        Public Sub Refresh() Implements SAPbouiCOM.IItem.Refresh
            _SapItem.Refresh()
        End Sub

        Public Property RightJustified As Boolean Implements SAPbouiCOM.IItem.RightJustified
            Get
                Return _SapItem.RightJustified
            End Get
            Set(ByVal value As Boolean)
                _SapItem.RightJustified = value
            End Set
        End Property

        Public Sub SetAutoManagedAttribute(ByVal AttrType As SAPbouiCOM.BoAutoManagedAttr, ByVal ModeMask As Integer, ByVal Behavior As SAPbouiCOM.BoModeVisualBehavior) Implements SAPbouiCOM.IItem.SetAutoManagedAttribute
            _SapItem.SetAutoManagedAttribute(AttrType, ModeMask, Behavior)
        End Sub

        Public ReadOnly Property Specific As Object Implements SAPbouiCOM.IItem.Specific
            Get
                Return _SapItem.Specific
            End Get
        End Property

        Public Property TextStyle As Integer Implements SAPbouiCOM.IItem.TextStyle
            Get
                Return _SapItem.TextStyle
            End Get
            Set(ByVal value As Integer)
                _SapItem.TextStyle = value
            End Set
        End Property

        Public Property Top As Integer Implements SAPbouiCOM.IItem.Top
            Get
                Return _SapItem.Top
            End Get
            Set(ByVal value As Integer)
                _SapItem.Top = value
            End Set
        End Property

        Public Property ToPane As Integer Implements SAPbouiCOM.IItem.ToPane
            Get
                Return _SapItem.ToPane
            End Get
            Set(ByVal value As Integer)
                _SapItem.ToPane = value
            End Set
        End Property

        Public ReadOnly Property Type As SAPbouiCOM.BoFormItemTypes Implements SAPbouiCOM.IItem.Type
            Get
                Return _SapItem.Type
            End Get
        End Property

        Public ReadOnly Property UniqueID As String Implements SAPbouiCOM.IItem.UniqueID
            Get
                Return _SapItem.UniqueID
            End Get
        End Property

        Public Sub Update() Implements SAPbouiCOM.IItem.Update
            _SapItem.Update()
        End Sub

        Public Property Visible As Boolean Implements SAPbouiCOM.IItem.Visible
            Get
                Return _SapItem.Visible
            End Get
            Set(ByVal value As Boolean)
                _SapItem.Visible = value
            End Set
        End Property

        Public Property Width As Integer Implements SAPbouiCOM.IItem.Width
            Get
                Return _SapItem.Width
            End Get
            Set(ByVal value As Integer)
                _SapItem.Width = value
            End Set
        End Property

        Public Function GetValue() As Object Implements IItem.GetValue
            Return B1Assistant.Item.GetValue(_SapItem)
        End Function

        Public Sub SetValue(ByVal Value As Object) Implements IItem.SetValue
            B1Assistant.Item.SetValue(_SapItem, Value)
        End Sub

        Public Sub AddValue(ByVal Value As Object) Implements IItem.AddValue
            B1Assistant.Item.AddValue(_SapItem, Value)
        End Sub

        Public Sub SetEnabled(ByVal Value As Boolean) Implements IItem.SetEnabled
            B1Assistant.Item.SetEnabled(_SapItem, Value)
        End Sub

        Public Sub SetVisable(ByVal Value As Boolean) Implements IItem.SetVisable
            B1Assistant.Item.SetVisible(_SapItem, Value)
        End Sub
    End Class
End Namespace

